package com.kk.observer.trational;

/**
 * @author o_o
 */
public class WeatherData {
    /**
     * 1.气温
     */
    private float temperature;
    /**
     * 2.气压
     */
    private float pressure;
    /**
     * 3.湿度
     */
    private float humidity;
    private CurrentWeather currentWeather;

    public WeatherData(CurrentWeather currentWeather) {
        this.currentWeather = currentWeather;
    }

    public float getTemperature() {
        return temperature;
    }

    public float getPressure() {
        return pressure;
    }

    public float getHumidity() {
        return humidity;
    }

    private void dataChange() {
        currentWeather.update(getTemperature(), getPressure(), getHumidity());
    }

    public void setWeatherData(float temperature, float pressure, float humidity) {
        this.temperature = temperature;
        this.pressure = pressure;
        this.humidity = humidity;
        dataChange();
    }
}
